<template>
    <div>
        <el-dialog width="30%" center :visible.sync="visible" title="كۆپلەپ يېڭىلاش">
            <el-form :model="info" label-width="120px">
                <el-form-item label="كىنو تەرتىپى :">
                    <span>{{info.vid}}</span>
                </el-form-item>
                <el-form-item label="كىنو ئىسمى :">
                    <!-- <span>{{form.title}}</span> -->
                    <el-row>
                        <el-col :span="18">
                            <el-input v-model="info.title" placeholder="كىنو ئىسمىنى كىرگۈزۈڭ"></el-input>
                        </el-col>
                    </el-row>
                </el-form-item>
                <el-form-item label="كىنو ئادىرىسى :">
                    <el-input size="small" v-model="info.videoUrl"></el-input>
                </el-form-item>
                <!-- <el-col :span="18">
                    <el-input v-model="info.videoUrl" placeholder="كىنو ئاىرىسىنى كىرگۈزۈڭ"></el-input>
                </el-col> -->
                <el-form-item label="بارلىق قىسىم">
                    <el-input v-model="qisim" type="textarea" placeholder="بارلىق قىسىمنى كىرگۈزۈڭ"></el-input>
                </el-form-item>
                <el-row style="text-align:center;">
                    <el-button type="primary" :rows="5" @click="update">يېڭىلاش</el-button>
                </el-row>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
import qs from "qs";
export default {
    props: {
        info: {
            type: Object,
            default: {}
        }
    },
    data() {
        return {
            visible: false,
            qisim: ""
        };
    },
    methods: {
        update() {
            // let sql2 = `REPLACE INTO tv (vid,title,coverImg,qisim) VALUES(${vid},'${title}','${coverImg}','${qisim}')`;

            let f = {
                ...this.info,
                qisim: this.qisim
            };
            this.$confirm("يېڭىلاشنى جەزملەشتۈرەمسىز")
                .then(_ => {
                    this.$http
                        .post("/updateVideoDetail", qs.stringify(f), {
                            headers: {
                                "Content-Type":
                                    "application/x-www-form-urlencoded"
                            }
                        })
                        .then(res => {
                            let status = res.data.data;
                            if (status.code == "001") {
                                this.$message.success(status.msg);
                                this.qisim = "";
                                this.visible = false;
                            } else {
                                this.$message.error(status.msg);
                            }
                        });
                })
                .catch(_ => {});
        }
    }
};
</script>

<style lang="scss" scoped>
</style>